package mina.forwhat.vo;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.springframework.beans.factory.annotation.Value;


@Entity
@Table(name="game_code")
public class GameCode {
	
	private static final long serialVersionUID = 6580544258864099373L;

	public static final String FRONT_BACK = "FB";
	public static final String BACK_FRONT = "BF";
	
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Integer id ;
	
	@Column(nullable = false,unique=true)
	private String code;

	private Date createTime;
	
	private String createUser;
	
	/**
	 * 安卓有效字段
	 */
	@Column(name="androidUseful",columnDefinition="tinyint default 1")
	private int androidUseful = 1;
	
	/**
	 * ios有效字段
	 */
	@Column(name="iosUseful",columnDefinition="tinyint default 1")
	private int iosUseful = 1;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}


	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getCreateUser() {
		return createUser;
	}

	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}


	public int getAndroidUseful() {
		return androidUseful;
	}

	public void setAndroidUseful(int androidUseful) {
		this.androidUseful = androidUseful;
	}

	public int getIosUseful() {
		return iosUseful;
	}

	public void setIosUseful(int iosUseful) {
		this.iosUseful = iosUseful;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public static String getFrontBack() {
		return FRONT_BACK;
	}

	public static String getBackFront() {
		return BACK_FRONT;
	}

	public GameCode(Integer id, String code, Date createTime, String createUser, int androidUseful, int iosUseful) {
		super();
		this.id = id;
		this.code = code;
		this.createTime = createTime;
		this.createUser = createUser;
		this.androidUseful = androidUseful;
		this.iosUseful = iosUseful;
	}
	
	public GameCode() {
	}

	@Override
	public String toString() {
		return "GameCode [id=" + id + ", code=" + code + ", createTime=" + createTime + ", createUser=" + createUser
				+ ", androidUseful=" + androidUseful + ", iosUseful=" + iosUseful + "]";
	}
	

	
	
	

//	@Override
//	public int compare(GameCode o1, GameCode o2) {
//		if (o1.getCreateTime().before(o2.getCreateTime())) {
//	        return 1;
//	    } else {
//	        return -1;
//	    }
//	}
	
	
}
